Probabilistic programming language systems provide for automatic generation of machine-learning algorithms. The user may write a short probabilistic program, often embedded within a larger conventional program, and the system may produce an algorithm for learning distributions given by the probabilistic program. Hence, probabilistic programming saves development costs compared to the alternative of manually writing the inference algorithm. In addition, probabilistic programming is more flexible than the alternative of relying on a fixed algorithm for a particular task, since variations of models with slightly different structures may be easily written.
However, the current practice of probabilistic programming is low-level, irregular, and unstructured. Probabilistic programs may represent Bayesian models, but they often lack a structure for defining the parameters, predicting the outputs, and observing the data. The absence of such structure prevents the re-use of code for performing standard tasks, such as training, parameter learning, and prediction. Moreover, there is a lack of structure for constructing mixture models, performing model selection, or implementing other repetitive probabilistic patterns. Therefore, it may be desirable to write Bayesian models in a generic format including a defined structure.